<template>
  <a-radio-group
    v-bind="$attrs"
    v-model:value="value"
    :options="dataSource"
    option-type="button"
    class="radio-group"
    @change="change"
  />
</template>

<script>
import useGroup, { GROUP_PROPS } from '../mixins/useGroup.js';
import { get } from 'lodash-es';

export default {
  name: 'radio-button-group',
  emits: ['change'],
  props: GROUP_PROPS,
  setup(props, ctx) {
    const { dataSource, value, output } = useGroup(props, ctx);
    const change = function (e) {
      output(get(e, 'target.value'));
    };
    return { dataSource, value, change };
  },
};
</script>

<style lang="less"></style>
